import Vue from 'vue';
//配置路由
import VueRouter from 'vue-router'
Vue.use(VueRouter);
//1.创建组件
import Index from '@/views/index'
import Home from '@/views/home'
import Login from '@/views/login'
import NotFound from '@/views/404'
import UpdatePassword from '@/views/update-password'
import pay from '@/views/pay'
import register from '@/views/register'
import center from '@/views/center'
    import shijiaohetong from '@/views/modules/shijiaohetong/list'
    import news from '@/views/modules/news/list'
    import aboutus from '@/views/modules/aboutus/list'
    import pingjiaxinxi from '@/views/modules/pingjiaxinxi/list'
    import xuesheng from '@/views/modules/xuesheng/list'
    import discussjiaoshi from '@/views/modules/discussjiaoshi/list'
    import wodekebiao from '@/views/modules/wodekebiao/list'
    import zaixianjiaoliu from '@/views/modules/zaixianjiaoliu/list'
    import discussjiaoshigangwei from '@/views/modules/discussjiaoshigangwei/list'
    import jiaoshi from '@/views/modules/jiaoshi/list'
    import discussjiajiaokechengxinxi from '@/views/modules/discussjiajiaokechengxinxi/list'
    import kechengxinxi from '@/views/modules/kechengxinxi/list'
    import yuyuequxiao from '@/views/modules/yuyuequxiao/list'
    import yingpinxinxi from '@/views/modules/yingpinxinxi/list'
    import kechengleixing from '@/views/modules/kechengleixing/list'
    import systemintro from '@/views/modules/systemintro/list'
    import jiaoshigangwei from '@/views/modules/jiaoshigangwei/list'
    import jiajiaoyuyue from '@/views/modules/jiajiaoyuyue/list'
import config from '@/views/modules/config/list'
import shoukeanpai from '@/views/modules/shoukeanpai/list'
import jiazhang from '@/views/modules/jiazhang/list'
import messages from '@/views/modules/messages/list'


//2.配置路由   注意：名字
const routes = [{
    path: '/index',
    name: '系统首页',
    component: Index,
    children: [{
      // 这里不设置值，是把main作为默认页面
      path: '/',
      name: '系统首页',
      component: Home,
      meta: {icon:'', title:'center'}
    }, {
      path: '/updatePassword',
      name: '修改密码',
      component: UpdatePassword,
      meta: {icon:'', title:'updatePassword'}
    }, {
      path: '/pay',
      name: '支付',
      component: pay,
      meta: {icon:'', title:'pay'}
    }, {
      path: '/center',
      name: '个人信息',
      component: center,
      meta: {icon:'', title:'center'}
    }
      ,{
	path: '/shijiaohetong',
        name: '试教合同',
        component: shijiaohetong
      }
        ,{
            path: '/shoukeanpai',
            name: '授课安排',
            component: shoukeanpai
        }
        ,{
            path: '/messages',
            name: '留言反馈',
            component: messages
        }
        ,{
            path: '/jiazhang',
            name: '家长',
            component: jiazhang
        }

        ,{
	path: '/news',
        name: '家教资讯',
        component: news
      }
      ,{
	path: '/aboutus',
        name: '关于我们',
        component: aboutus
      }
      ,{
	path: '/pingjiaxinxi',
        name: '评价信息',
        component: pingjiaxinxi
      }
      ,{
	path: '/xuesheng',
        name: '学生',
        component: xuesheng
      }
      ,{
	path: '/discussjiaoshi',
        name: '教师评论',
        component: discussjiaoshi
      }
      ,{
	path: '/wodekebiao',
        name: '我的课表',
        component: wodekebiao
      }
      ,{
	path: '/zaixianjiaoliu',
        name: '在线交流',
        component: zaixianjiaoliu
      }
      ,{
	path: '/discussjiaoshigangwei',
        name: '教师岗位评论',
        component: discussjiaoshigangwei
      }
      ,{
	path: '/jiaoshi',
        name: '教师',
        component: jiaoshi
      }
      ,{
	path: '/discussjiajiaokechengxinxi',
        name: '课程信息评论',
        component: discussjiajiaokechengxinxi
      }
      ,{
	path: '/kechengxinxi',
        name: '课程信息',
        component: kechengxinxi
      }
      ,{
	path: '/yuyuequxiao',
        name: '更换教师',
        component: yuyuequxiao
      }
      ,{
	path: '/yingpinxinxi',
        name: '应聘信息',
        component: yingpinxinxi
      }
      ,{
	path: '/kechengleixing',
        name: '课程类型',
        component: kechengleixing
      }
      ,{
	path: '/systemintro',
        name: '系统简介',
        component: systemintro
      }
      ,{
	path: '/jiaoshigangwei',
        name: '教师岗位',
        component: jiaoshigangwei
      }
      ,{
	path: '/jiajiaoyuyue',
        name: '家教面试',
        component: jiajiaoyuyue
      }
      ,{
	path: '/config',
        name: '轮播图管理',
        component: config
      }
    ]
  },
  {
    path: '/login',
    name: 'login',
    component: Login,
    meta: {icon:'', title:'login'}
  },
  {
    path: '/register',
    name: 'register',
    component: register,
    meta: {icon:'', title:'register'}
  },
  {
    path: '/',
    name: '系统首页',
    redirect: '/index'
  }, /*默认跳转路由*/
  {
    path: '*',
    component: NotFound
  }
]
//3.实例化VueRouter  注意：名字
const router = new VueRouter({
  mode: 'hash',
  /*hash模式改为history*/
  routes // （缩写）相当于 routes: routes
})
const originalPush = VueRouter.prototype.push
//修改原型对象中的push方法
VueRouter.prototype.push = function push(location) {
   return originalPush.call(this, location).catch(err => err)
}
export default router;
